<template>
    <div>
        <h2 @click="changeUsername('zuozuomu')">Find - Find - 发现  -- {{num}}</h2>
        <h2 @click="changeAge(10)">用户信息 - - {{username}} -- {{age}}</h2>
        <h2 @click="changewps">wps  -- {{wps}}</h2>
        <ul>
            <li v-for="(l,i) in list" :key='i'> 
                {{l.goodsName}}
            </li>
        </ul>
    </div>
</template>

<script>
import axios from "axios"
import {mapState,mapMutations} from 'vuex'
export default {
    // 局部混入
    mixins:[
        {
            mounted(){
                console.log("FInd - FInd - FInd ")
            }
        }
    ],
    data(){
        return {
            list:[]
        }
    },
    methods:{
        ...mapMutations('user1',['changeAge','changeUsername'])
    },
    computed:{
        ...mapState(['num']),
        ...mapState('user1',['age','username'])
    },
    mounted(){
        axios({
            method:"get",
            url:"/getGoods",
        })
        .then(res=>{
            console.log(res)
            this.list = res.data.data 
        })

        axios({
            method:"post",
            url:'/getdata1'
        }).then(res=>{
            console.log(res)
        })
    }
}
</script>